package cn.six1943.deepchat.module.ai.dal.mysql.model;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.six1943.deepchat.module.ai.dal.dataobject.model.ProviderInstDO;
import org.apache.ibatis.annotations.Mapper;
import cn.six1943.deepchat.module.ai.controller.admin.umodel.vo.*;

/**
 * 提供商 Mapper
 *
 * @author at1943
 */
@Mapper
public interface ProviderInstMapper extends BaseMapperX<ProviderInstDO> {

    default PageResult<ProviderInstDO> selectPage(AppProviderInstPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ProviderInstDO>()
                .eqIfPresent(ProviderInstDO::getDataType, reqVO.getDataType())
                .eqIfPresent(ProviderInstDO::getProviderType, reqVO.getProviderType())
                .eqIfPresent(ProviderInstDO::getAvatar, reqVO.getAvatar())
                .eqIfPresent(ProviderInstDO::getBaseUrl, reqVO.getBaseUrl())
                .eqIfPresent(ProviderInstDO::getApiVersion, reqVO.getApiVersion())
                .eqIfPresent(ProviderInstDO::getApiRegion, reqVO.getApiRegion())
                .eqIfPresent(ProviderInstDO::getApiAk, reqVO.getApiAk())
                .eqIfPresent(ProviderInstDO::getApiSk, reqVO.getApiSk())
                .betweenIfPresent(ProviderInstDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(ProviderInstDO::getStatus, reqVO.getStatus())
                .orderByDesc(ProviderInstDO::getId));
    }

}